package org.lanqiao.tjut.controller;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.lanqiao.tjut.bean.EmployeeBean;
import org.lanqiao.tjut.model.ModelFactory;
import org.lanqiao.tjut.myUtils.MyUtils;

import com.alibaba.fastjson.JSON;

/**
 * 查询操作 EmployeeInfoSearchServlet
 */
@WebServlet("/EmployeeInfoSearchServlet")
public class EmployeeInfoSearchServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	
	protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// 查询操作
		EmployeeBean empB = MyUtils.convertRequest2Bean(request, EmployeeBean.class, null, null);
		List<EmployeeBean> lstEmps = ModelFactory.getEmployeeInfoAddModelInstance().queryEmployeeInfoByParams(empB);
		String strJson = JSON.toJSONStringWithDateFormat(lstEmps,"yyyy-MM-dd HH:mm:ss");
		//使用writer对象将服务器响应内容写到客户端
		PrintWriter pw = response.getWriter();
		pw.write(strJson);
		pw.flush();
		pw.close();
		}

}
